package com.thinkgem.jeesite.modules.building.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.building.dao.BuildingDao;
import com.thinkgem.jeesite.modules.building.entity.Building;
import com.thinkgem.jeesite.modules.sys.entity.User;
import com.thinkgem.jeesite.modules.sys.utils.UserUtils;

@Service
@Transactional(readOnly = true)
public class BuildingService extends CrudService<BuildingDao,Building>{
	@Autowired
	BuildingDao buildingDao;
	public Page<Building> findMyList(Page<Building> page,Building building){
		building.setPage(page);
		building.setId(UserUtils.getUser().getId());
		page.setList(buildingDao.findMyList(building));
		return page;
	}
	public List<Building> findAllBuildingName(){
		return buildingDao.findAllBuildingName();
	}
	@Transactional(readOnly = false)
	public void insertBuilding(Building building){
		buildingDao.insertBuilding(building);
	}
	@Transactional(readOnly = false)
	public void updateAdminsId(Building building){
		buildingDao.updateAdminsId(building);
	}
	@Transactional(readOnly = false)
	public void deleteBuildingById(String id){
		buildingDao.deleteBuildingById(id);
	}
}
